#ifndef NIXONBOT_CORE_BNCS_PROTOCOL_ACCOUNTLOGONPROOFCLIENT_H_
#define NIXONBOT_CORE_BNCS_PROTOCOL_ACCOUNTLOGONPROOFCLIENT_H_

#include <nixonbot/core/bncs/protocol/Message.h>
#include <nixonbot/core/bncs/protocol/MessageFactory.h>

namespace nixonbot {
namespace core {
namespace bncs {
namespace protocol {

struct AccountLogonProofClientData : public QSharedData
{
  quint8 clientProof[20];
};

class AccountLogonProofClient : public Message
{
public:
	static const int id = 0x54;
	BNCS_MESSAGE_CLIENT_REGISTER(AccountLogonProofClient, id);

public:
	QSharedDataPointer<AccountLogonProofClientData> d;

public:
	AccountLogonProofClient()
	{
		d = new AccountLogonProofClientData();
	}
	
	virtual AccountLogonProofClient* create()
	{
		return new AccountLogonProofClient();
	}
	
	virtual quint32 id()
	{
		return id;
	}

	virtual int size()
	{
		return sizeof(d->clientProof);
	}

protected:
	virtual void readFrom(QDataStream& ds)
	{
		int bo = ds.byteOrder();
		ds.setByteOrder(QDataStream::LittleEndian);

		ds.readRawData((char*)d->clientProof, sizeof(d->clientProof));

		ds.setByteOrder((QDataStream::ByteOrder)bo);
	}

	virtual void writeTo(QDataStream& ds)
	{
		int bo = ds.byteOrder();
		ds.setByteOrder(QDataStream::LittleEndian);

		ds.writeRawData((char*)d->clientProof, sizeof(d->clientProof));

		ds.setByteOrder((QDataStream::ByteOrder)bo);
	}
};

}
}
}
}

#endif /*NIXONBOT_CORE_BNCS_PROTOCOL_ACCOUNTLOGONCLIENT_H_*/
